﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Howork
{
    public partial class DBTest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            //测试
            DBAdapter db = new DBAdapter();
            //db.addDeviceType(TypeName.Text);
            //db.deleteDeviceType(10);
            //db.getDeviceTypeList();
            //db.addDevice("汽车测试", 4);
            //db.deleteDevice(10);
            //db.getDeviceList();
            DateTime time1 = new DateTime(2012, 2, 4, 14, 15, 15);
            DateTime time2 = new DateTime(2012, 6, 4, 14, 15, 15);
            List<DeviceUsage> his = db.getDeviceUsageHistory(time1, time2, 1);
            //String fileName = FileAdapter.getCSV(his, "his.csv");


            //下载
            //Page.Response.Clear();
            //bool success = FileAdapter.provideCSVDownload(Page.Request, Page.Response, fileName, 1024000);
            //if (!success)
            //    Response.Write("下载文件出错！");
            //Page.Response.End();
        }
    }
}